﻿@{
    ViewBag.Title = "Trao đổi tài liệu";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";


}
<link href="~/Content/standard_form_nhaplieu.css" rel="stylesheet" />
<link href="@Url.Content("~/Content/jquery-ui.1.10.2.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.maskedinput.js")"></script>
<style>
    tbdata {
        table-layout: fixed;
        word-wrap: break-word;
        font-size: small;
    }

    .ct {
        text-align: center;
    }

    .e-input3 {
        background-color: #fae8e8;
        border: 1px solid #ddd;
        text-align: left;
        border-radius: 3px;
        padding: 5px;
        height: 26px;
        font-family: "Open Sans", arial !important;
        box-shadow: 0 1px 1px rgba(50,50,50,0.1);
    }

    .e-input1 {
        background-color: #ddd;
        border: 1px solid #ddd;
        text-align: left;
        border-radius: 3px;
        padding: 5px;
        height: 26px;
        font-family: "Open Sans", arial !important;
        box-shadow: 0 1px 1px rgba(50,50,50,0.1);
    }

    .e-input2 {
        border: 1px solid #ddd;
        background: #bee6ff;
        text-align: left;
        border-radius: 3px;
        padding: 5px;
        height: 26px;
        font-family: "Open Sans", arial !important;
        box-shadow: 0 1px 1px rgba(50,50,50,0.1);
    }
</style>
<style>
    legend a {
        color: inherit;
    }

    legend.legendStyle {
        padding-left: 5px;
        padding-right: 5px;
    }

    fieldset.fsStyle {
        font-family: Verdana, Arial, sans-serif;
        font-size: small;
        font-weight: normal;
        border: 1px solid #999999;
        padding: 4px;
        margin: 5px;
    }

    legend.legendStyle {
        font-size: 90%;
        color: #888888;
        background-color: transparent;
        font-weight: bold;
    }

    legend {
        width: auto;
        border-bottom: 0px;
    }
</style>
<div class="page-bar">
    <ul class="page-breadcrumb" style="padding: 4px;">
        <li>
            <i class="fa fa-home"></i>
            <a href="#">Trao đổi tài liệu</a>
        </li>
    </ul>
</div>
<div class="row margin-bottom-20">
    <div class="col-md-5">
        <div class="row" style="margin-top:5px;">
            @Html.Label("Số văn bản", new { @class = "col-md-5", id = "lb1" })
            <div class="col-md-7">
                @Html.TextBox("Sovanban", "", new { id = "Sovanban", style = "margin:0px;", @class = "form-control input-sm" })
            </div>
        </div>
    </div>
    <div class="col-md-5">
        <div class="row" style="margin-top:5px;">
            @Html.Label("Ngày", new { @class = "col-md-5", id = "lb1" })
            <div class="col-md-7">
                @Html.TextBox("ngayhieuluc", "", new { id = "ngayhieuluc", style = "margin:0px;", @class = "form-control input-sm" })
            </div>
        </div>
    </div>
    <div class="col-md-2">
        <div class="row" style="margin-top:5px; text-align:right;">
            <div class="col-md-12">
                <button type="button" class="btn btn-sm btn-default" id="Create" style="width: 90px; margin-bottom: 5px; cursor:pointer;"><i class="fa fa-plus-square-o"></i> Tạo mới</button>
                <button type="button" class="btn btn-sm btn-default" id="Search" style="width: 90px; margin-bottom: 5px; cursor:pointer;"><i class="fa fa-plus-square-o"></i> Tìm kiếm</button>
            </div>
        </div>
    </div>
</div>
<div id="gridContent" align="center">
    <fieldset class="fsStyle">
        <legend class="legendStyle">
            <a data-toggle="collapse" data-target="#demo" href="#">Danh sách tài liệu upload</a>
        </legend>
        <table class="table table-striped table-bordered table-hover dataTable no-footer" style="width:99%;">
            <thead>
                <tr class="header">
                    <th scope="col" width="3%;">
                        STT
                    </th>
                    <th scope="col" width="10%;">
                        Số văn bản
                    </th>
                    <th scope="col" class="hidden-480" width="10%;">
                        Ngày
                    </th>
                    <th scope="col" class="hidden-480" width="50%;">
                        Trích yếu
                    </th>
                    <th scope="col" class="hidden-480" width="20%;">
                        File
                    </th>
                    <th scope="col" width="7%;">Thao tác</th>
                </tr>
            </thead>
            <tbody id="body"></tbody>
        </table>
    </fieldset>
</div>
<div id="gridContentshare" align="center">
    <fieldset class="fsStyle">
        <legend class="legendStyle">
            <a data-toggle="collapse" data-target="#demo" href="#">Danh sách tài liệu được chia sẻ</a>
        </legend>
        <table class="table table-striped table-bordered table-hover dataTable no-footer" style="width:99%;">
            <thead>
                <tr class="header">
                    <th scope="col" width="3%;">
                        STT
                    </th>
                    <th scope="col" width="20%;">
                        Đơn vị ban hành
                    </th>
                    <th scope="col" width="10%;">
                        Số văn bản
                    </th>
                    <th scope="col" class="hidden-480" width="10%;">
                        Ngày
                    </th>
                    <th scope="col" class="hidden-480" width="30%;">
                        Trích yếu
                    </th>
                    <th scope="col" class="hidden-480" width="20%;">
                        File
                    </th>
                </tr>
            </thead>
            <tbody id="bodyshare"></tbody>
        </table>
    </fieldset>
</div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header" style="color: white;background-color: #428bca;border-color: #357ebd;">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">Thêm mới tài liệu !</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-5">
                        <label>
                            Số văn bản
                        </label>
                    </div>
                    <div class="col-md-5">
                        <input class="form-control input-sm" id="svban" />
                    </div>
                </div>
                <br />
                <div class="row">
                    <div class="col-md-5">
                        <label>
                            File đính kèm
                        </label>
                    </div>
                    <div class="col-md-5">
                        <input type="file" accept="application/msword, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/plain,.pdf,.csv,image/*" class="form-control input-sm" id="filedinhkem" />
                    </div>
                </div>

                <br />
                <div class="row">
                    <div class="col-md-5">
                        <label>
                            Trích yêu
                        </label>
                    </div>
                    <div class="col-md-5">
                        @Html.TextArea("Tyeu", "", new { id = "tyeu", style = "margin:0px;height: 178px;", @class = "form-control input-sm" })
                    </div>
                </div>
                <br />
                <div class="row">
                    <center>
                        <div class="progress" style="width:90%;">
                            <div id="progress" class="progress-bar progress-bar-striped active" role="progressbar">
                                <span>0%</span>
                            </div>
                        </div>
                    </center>
                </div>
                <div class="row" style="display:none;">

                    <input id="vanbanid" value="0" style="display:none" />
                </div>
            </div>
            <div class="modal-footer" style="clear:both">
                <button type="button" id="Upload" class="btn btn-primary">Thêm mới</button>
                <button type="button" id="Update" class="btn btn-primary" style="display:none;">Cập nhật</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModalDSDonvi" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header" style="color: white;background-color: #428bca;border-color: #357ebd;">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">Danh sách đơn vị</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-6">
                        <table class="table table-striped table-bordered table-hover dataTable no-footer">
                            <thead>
                                <tr class="header">
                                    <th scope="col" width="20%;">
                                        STT
                                    </th>
                                    <th scope="col" width="70%;">
                                        Đơn vị
                                    </th>
                                    <th scope="col" class="hidden-480" width="10%;">
                                        <input type="checkbox" id="checkall1" />
                                    </th>
                                </tr>
                            </thead>
                            <tbody id="body1"></tbody>
                        </table>
                    </div>
                    <div class="col-md-6">
                        <table class="table table-striped table-bordered table-hover dataTable no-footer">
                            <thead>
                                <tr class="header">
                                    <th scope="col" width="20%;">
                                        STT
                                    </th>
                                    <th scope="col" width="70%;">
                                        Đơn vị
                                    </th>
                                    <th scope="col" class="hidden-480" width="10%;">
                                        <input type="checkbox" id="checkall2" />
                                    </th>
                                </tr>
                            </thead>
                            <tbody id="body2"></tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="clear:both">
                <button type="button" id="Savephanquyen" class="btn btn-primary">Phân quyền</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
            </div>
        </div>
    </div>
</div>
<script>
    @functions{
           public string GetAntiForgeryToken()
           {
               string cookieToken, formToken;
               AntiForgery.GetTokens(null, out cookieToken, out formToken);
               return cookieToken + "," + formToken;
           }
       }
</script>
<script src="@Url.Content("~/Scripts/DHQG/jquery.ajax-progress.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/DHQG/ShareFile.js?huyen=01")" type="text/javascript"></script>
<script>
    $(function () {
        var initData = {
            VerificationToken: "@GetAntiForgeryToken()",
            ShareFileSave: "@Url.Action("ShareFileSave","Kehoachnam")",
            GetShareFilebyUser: "@Url.Action("GetShareFilebyUser","Kehoachnam")",
            GetAllDV: "@Url.Action("GetAllDV","Kehoachnam")",
            DonviID: "@ViewBag.DonviID",
            Username: "@ViewBag.Username",
            SavePhanQuyen: "@Url.Action("SavePhanQuyen", "Kehoachnam")",
            GetPhanquynbyVanban: "@Url.Action("GetPhanquynbyVanban", "Kehoachnam")",
            GetShareFilebyId: "@Url.Action("GetShareFilebyId", "Kehoachnam")",
            ShareFileUpdate: "@Url.Action("ShareFileUpdate", "Kehoachnam")",
            DeleteShareFile: "@Url.Action("DeleteShareFile", "Kehoachnam")",
            GetShareFilebyDonvitruycap: "@Url.Action("GetShareFilebyDonvitruycap", "Kehoachnam")",
            GetShareFilebyUserSearch: "@Url.Action("GetShareFilebyUserSearch", "Kehoachnam")"
        };
        ShareFile.init(initData);
    });
    function datePicker() {
        var option = {
            //dayNamesMin: ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"],
            dayNamesMin: ["CN", "2", "T3", "T4", "T5", "T6", "T7"],
            monthNames: ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5",
                "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"],
            dateFormat: "dd/mm/yy",
            onSelect: function (selectedDate) {
                //alert(selectedDate);

            }
        };

        $("#ngayhieuluc").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
        $("#ngayhieuluc").datepicker(option);
    }
    $(document).ready(function () {
        datePicker();
        var fl = document.getElementById('filedinhkem');

        fl.onchange = function (e) {
            var ext = this.value.match(/\.(.+)$/)[1];
            switch (ext) {
                case 'jpg':
                    break;
                case 'bmp':
                    break;
                case 'png':
                    break;
                case 'xlsx':
                    break;
                case 'xls':
                    break;
                case 'doc':
                    break;
                case 'docx':
                    break;
                case 'pdf':
                    break;
                case 'ppt':
                    break;
                case 'ppx':
                    break;
                case 'csv':
                    break;
                case 'txt':
                    break;
                default:
                    alert('Không hỗ trợ định dạng file trên. Vui lòng kiểm tra lại file !');
                    this.value = '';
            }
        };
    })


</script>


